/*
 * SonarQube
 * Copyright (C) 2009-2017 SonarSource SA
 * mailto:info AT sonarsource DOT com
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
@import (reference) '../mixins';
@import (reference) '../variables';
@import (reference) '../init/links';
@import (reference) '../components/ui';

@facetsHeight: 36px;

.coding-rules-page {

  .navigator-facets {
    min-height: 3 * @facetsHeight;
  }

  .navigator-results .spinner {
    margin: @navigatorPadding;
  }

  .navigator-results .line-right {
    margin-top: -14px;
    float: none;
    text-align: right;
  }

  .navigator-results-list .line {
    padding-top: 3px;
    padding-bottom: 3px;
  }

  .navigator-results-list .line + .line {
    padding-top: 0;
  }

  .navigator-results-list .line-small {
    color: @secondFontColor;
  }

}

.navigator-filter-query {
  min-width: 40em;
  padding: 0 5px;

  input {
    height: 80%;
    width: 100%;
    font-size: @baseFontSize;
    vertical-align: middle;
    vertical-align: -webkit-baseline-middle;
  }
}


/*
 * Detail
 */

.coding-rules-detail-title {
  position: relative;
  font-size: @bigFontSize;
  font-weight: 400;
}

.coding-rules-detail-title,
.coding-rules-detail-actions {
  margin: 16px 0;
}

.coding-rules-detail-title {
  display: inline-block;
}

.coding-rules-detail-title-first {
  margin-top: 6px;
}

.coding-rules-detail-context {
  margin-bottom: @navigatorPadding;
  padding: @navigatorPadding / 2;
  border: 1px solid @contextBorder;
  background-color: @contextBackground;

  .coding-rules-detail-quality-profile { margin-left: 0; }
  .coding-rules-detail-quality-profile-name,
  .coding-rules-detail-quality-profile-severity,
  .coding-rules-detail-quality-profile-parameters,
  .coding-rules-detail-quality-profile-actions {
    vertical-align: top;
  }
  .coding-rules-detail-quality-profile-name,
  .coding-rules-detail-quality-profile-severity {
    width: 1px;
    padding-right: @navigatorPadding;
    white-space: nowrap;
  }

  .coding-rules-detail-quality-profile-parameter {
    display: table-cell;
  }
}

.coding-rules-detail-quality-profile-parameter {
  display: block;
  height: 100%;
  padding-top: 0;
  padding-right: @navigatorPadding;

  .key, .value, .sep {
    display: inline;
    vertical-align: top;
  }

  .value {
    display: inline-block;
    vertical-align: top;
    line-height: 23px;
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: @monoFontFamily;
  }
}
.coding-rules-detail-quality-profile-parameter + .coding-rules-detail-quality-profile-parameter { margin-top: 0; }

.coding-rules-detail-context-actions {

  padding: @navigatorPadding / 2;
  background-color: @contextBackground;
  border: 1px solid @contextBorder;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.coding-rules-detail-context-actions-quality-profile {
  vertical-align: middle;
  margin-right: @navigatorPadding;
  font-weight: bold;
}

.coding-rules-detail-context-actions-item {
  display: inline-block;
  vertical-align: middle;
  margin-right: @navigatorPadding;

  .limited {
    display: inline-block;
    vertical-align: middle;
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .limited-big {
    max-width: 480px;
  }
}

.coding-rules-detail-properties {
  margin: @navigatorPadding 0;
  font-size: 0;
}

.coding-rules-detail-properties + .coding-rules-detail-properties {
  margin-top: -@navigatorPadding;
}

.coding-rules-detail-property {
  display: inline-block;
  vertical-align: middle;
  margin-right: 2 * @navigatorPadding;
  font-size: @smallFontSize;
  height: 22px;
  line-height: 18px;

  .select2-search-field { line-height: 1; }
}

.coding-rules-subcharacteristic {
  cursor: pointer;
}

.coding-rules-debt-popup {
  h3 {
    display: inline
  }
}

.coding-rules-detail-tag + .coding-rules-detail-tag {
  margin-left: @navigatorPadding;
}

.coding-rules-detail-tags-change {
  cursor: pointer;

  &:hover {
    span { text-decoration: underline; }
  }
}

.coding-rules-detail-tag-edit {
  line-height: 1;
}

.coding-rules-details-tag-edit-cancel {
  vertical-align: middle;
}

.coding-rules-detail-description {
  margin: 2 * @navigatorPadding 0;
}

.coding-rules-detail-description-extra {
  margin-top: -@navigatorPadding;
}

.coding-rules-detail-extend-description-form {
  margin: @navigatorPadding 0;
}

.coding-rules-detail-parameters {
  width: 100%;
  margin: @navigatorPadding 0 @navigatorPadding * 2;
}

.coding-rules-detail-parameter {

}

.coding-rules-detail-parameter-name {
  width: 1px;
  vertical-align: top;
  padding: 5px 10px 5px 0;
  font-weight: bold;
}

.coding-rules-detail-parameter-description {
  vertical-align: top;
  padding: 5px 5px;
}

.coding-rules-detail-parameter-value {
  font-family: @monoFontFamily;
  word-break: break-all;
}

.coding-rules-detail-parameter-details {
  display: inline-block;
  font-size: @baseFontSize;
  padding-left: 5px;
}

.coding-rules-detail-parameter-original {
  margin-left: @navigatorPadding;
  font-size: @smallFontSize;
}


// Quality Profiles
.coding-rules-detail-quality-profiles-section {

}

.coding-rules-detail-quality-profiles-header {
  margin-top: 3 * @navigatorPadding;
}

.coding-rules-detail-quality-profiles,
.coding-rules-detail-list {
  width: 100%;
  line-height: 22px;

  td {
    border-top: 1px solid @barBorderColor;
  }

  tr:first-child td {
    border-top: none;
  }
}

.coding-rules-detail-quality-profile-name,
.coding-rules-detail-list-name {
  vertical-align: top;
  width: 1px;
  padding: 8px 5px 8px 0;
  font-weight: 600;
  white-space: nowrap;
}

.coding-rules-detail-quality-profile-severity,
.coding-rules-detail-list-severity {
  vertical-align: top;
  width: 1px;
  padding: 8px 5px;
  white-space: nowrap;
}

.coding-rules-detail-quality-profile-severity i {
  margin-top: 4px;
}

.coding-rules-detail-quality-profile-parameters,
.coding-rules-detail-list-parameters {
  vertical-align: top;
  padding: 8px 5px;
}

.coding-rules-detail-quality-profile-actions,
.coding-rules-detail-list-actions {
  vertical-align: top;
  width: 1px;
  padding: 8px 0 8px 5px;
  text-align: right;
  white-space: nowrap;
}

.coding-rules-detail-quality-profile-inheritance {
  margin-top: 4px;
  font-size: @smallFontSize;
  font-weight: normal;

  i {
    position: relative;
    top: -1px;
    font-size: @iconSmallFontSize;
  }
}

.coding-rules-detail-quality-profiles-activation {
  margin-top: -3px;
  margin-left: @navigatorPadding;
}

.coding-rules-detail-quality-profiles-template-caption {
  margin-bottom: @navigatorPadding;
}

// Bulk Change
.coding-rules-bulk-change-dropdown {
  position: absolute;
  z-index: @dropdown-menu-z-index;
  width: 200px;
  border: 1px solid @barBorderColor;
  box-sizing: border-box;
  box-shadow: 10px 10px 20px rgba(0, 0, 0, 0.5);
  background-color: #fff;
}

.coding-rules-bulk-change-dropdown-link {
  display: block;
  max-width: 190px;
  height: 30px;
  line-height: 30px;
  padding: 0 @navigatorPadding;
  font-size: @smallFontSize;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  .link-no-underline;
  transition: all 0.2s ease;

  &:hover { background-color: @barBackgroundColor; }

  strong {
    font-weight: bold;
  }
}

input.coding-rules-name-key {
  width: 100%;
}

textarea.coding-rules-markdown-description {
  width: 100%;
  margin-bottom: 4px;
}

.coding-rules-modal .property {
  input, textarea {
    width: 100%;
  }
}

.coding-rules-subcharacteristic-more {
  display: none;
}

.coding-rules-list-tags {
  display: inline-block;
  vertical-align: top;
  max-width: 50%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  .icon-tags:before { font-size: 12px; }
}

.coding-rules-most-violated-projects {

  td {
    border-top-color: transparent;
  }

  tr:first-child + tr td {
    border-top-color: @barBorderColor;
  }

  .coding-rules-detail-list-name {
    font-weight: 400;
  }
}
